﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LJ.EventBus.HornedSerpent.Transport.Abstractions;


/// <inheritdoc />
/// <summary>
/// 消息队列消费者客户端
/// </summary>
public interface IEventBusConsumerClient : IDisposable
{
    /// <summary>
    /// 创建（如果需要）并获取主题标识符
    /// </summary>
    void FetchTopic();

    /// <summary>
    /// 
    /// </summary>
    /// <param name=""></param>
    void Subscribe();

    /// <summary>
    /// 开始监听
    /// </summary>
    Task ListeningAsync(TimeSpan timeout, CancellationToken cancellationToken);

    /// <summary>
    /// 消息消费完成时手动提交消息偏移量
    /// </summary>
    void Commit(object? sender);

    /// <summary>
    /// 拒绝消息并恢复
    /// </summary>
    void Reject(object? sender);

    Func<EventBusTransportData, object, Task>? OnDataCallback { get; set; }

    Action<EventBusTransportLog>? OnLogCallback { get; set; }

}